var a = require("../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        listData: [],
        userObj: {},
        love_title: "",
        loveName: "爱心值",
        isLoadMore: !0,
        total_page: 0,
        page: 1
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    _getMoreData: function() {
        var e = this;
        if (!(this.data.page >= this.data.total_page)) {
            var n = t.getNetAddresss("plugin.love-ranking.api.index.index");
            this.data.page++, t._postNetWork({
                url: n,
                data: {
                    page: this.data.page
                },
                success: function(t) {
                    var n = t.data;
                    if (1 == n.result) {
                        var o = n.data.getSet.love_ranking;
                        o.ranking.current_page >= o.ranking.last_page && e.setData({
                            isLoadMore: !1
                        });
                        var i = e.data.listData;
                        i.push.apply(i, a(o.ranking.data)), e.setData({
                            listData: i
                        });
                    }
                },
                fail: function(a) {
                    console.log(a.msg);
                }
            });
        }
    },
    onShareAppMessage: function() {},
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.love-ranking.api.index.index");
        t._postNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    var n = e.data.getSet.love_ranking, o = n.ranking.data;
                    a.data.total_page = n.ranking.last_page, n.ranking.current_page >= n.ranking.last_page && a.setData({
                        isLoadMore: !1
                    });
                    var i = {};
                    i.avatar = n.information.avatar, i.nickname = n.information.nickname, i.countLove = n.countLove, 
                    i.countNO = n.countNO, a.setData({
                        listData: o,
                        loveName: e.data.getSet.title,
                        userObj: i
                    }), "" != e.data.getSet.love_title && wx.setNavigationBarTitle({
                        title: e.data.getSet.love_title
                    });
                }
            }
        });
    },
    gotoBusinessCard: function(a) {
        var t = a.currentTarget.dataset.card;
        console.log(t), t && void 0 !== t ? wx.navigateTo({
            url: "/packageB/member/business_card/BusinessCard/BusinessCard?mark=card&card_id=" + t
        }) : wx.showToast({
            icon: "none",
            title: "该会员没有对应的名片"
        });
    }
});